//Thu Apr 15 19:45:26 CDT 2010
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class LateProfessor
{
public:
	double getProbability(int waitTime, int walkTime, int lateTime,
			int bestArrival, int worstArrival)
	{
		if (walkTime < lateTime)
			return 0.0;
		int count = 0;
		for (int i = bestArrival; i < worstArrival; i++)
		{
			int t = i % (waitTime + walkTime);
			if (t >= waitTime && t + lateTime < waitTime + walkTime)
				count++;
		}
		if (bestArrival == worstArrival)
		{
			cout << count << endl;
			int t = bestArrival % (walkTime + waitTime);
			if(t > waitTime && t+lateTime <= waitTime + walkTime)
				return 1.0;
			return 0.0;
//			if(count != 0) return 1.0;
//			else return 0.0;
		}
		else
			return 1.0 * count / (1.0 * worstArrival - bestArrival);
	}
};
